package com.qfedu.openplateform.manager.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author LLFZH
 * @date 2021/10/27 20:12
 * @className GetTime
 * @description ：
 */
public class GetTime {
    public static Date getTime() throws ParseException {
        Long timeMillis = System.currentTimeMillis();

        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        String format = dateFormat.format(new Date(timeMillis));

        Date parse = dateFormat.parse(format);

        return parse;
    }

    public static Long getOrderId() {
        Long l = System.currentTimeMillis();
        String string1 = l.toString();

        Double random = Math.random();
        String string = random.toString();
        String substring = string.substring(2, 4);

        string1 = string1 + substring;
        Long aLong = Long.valueOf(string1);

        return aLong;
    }
}
